"use strict";
cc._RF.push(module, '0fbfeXlJnlCNotkQddUtR0t', 'block');
// script/star_project/game/block.js

"use strict";

cc.Class({
  "extends": cc.Component,
  properties: {
    spf_block: {
      type: [cc.SpriteFrame],
      "default": []
    }
  },
  // LIFE-CYCLE CALLBACKS:
  onLoad: function onLoad() {
    //锤子🔨特效
    this.isChuiZi = false;
    this.isTuya = false;
    this.isIndicate = false; //动画

    this.click_anim = this.node.getComponent(cc.Animation);
    this.state_anim = click_anim.getAnimationState("click_block");
  },
  init: function init(_type) {
    this.blockType = _type;
    this.star_isdestory = false;
    this.node.getComponent(cc.Sprite).spriteFrame = this.spf_block[this.blockType];
  },
  start: function start() {},
  set_IsChuiZZi: function set_IsChuiZZi(iscuizi) {
    this.isChuiZi = iscuizi;

    if (this.isChuiZi) {
      this.node.getChildByName("block_select").active = true;
    } else {
      this.node.getChildByName("block_select").active = false;
    }
  },
  get_IsChuiZZi: function get_IsChuiZZi() {
    return this.isChuiZi;
  },
  //涂鸦
  set_IsTuya: function set_IsTuya(isTuya) {
    this.isTuya = isTuya;

    if (this.isTuya) {
      this.node.getChildByName("block_select").active = true;
    } else {
      this.node.getChildByName("block_select").active = false;
    }
  },
  get_IsTuya: function get_IsTuya() {
    return this.isTuya;
  },
  //提示功能
  set_IsIndicate: function set_IsIndicate(isIndicate) {
    this.isIndicate = isIndicate;

    if (this.isIndicate) {
      this.node.getChildByName("block_select").active = true;
      this.click_anim.play("click_block");
    } else {
      this.node.getChildByName("block_select").active = false;

      if (this.state_anim.isPlaying) {
        this.click_anim.setCurrentTime(0, "click_block");
        this.click_anim.stop("click_block");
      }
    }
  },
  get_IsIndicate: function get_IsIndicate() {
    return this.isIndicate;
  } // update (dt) {},

});

cc._RF.pop();